import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.write.style.ColumnWidth;
import com.alibaba.excel.annotation.write.style.ContentRowHeight;
import com.alibaba.excel.converters.string.StringImageConverter;
import com.alibaba.excel.metadata.data.WriteCellData;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;

import java.io.File;
import java.io.InputStream;
import java.net.URL;

/**
 * 图片导出头
 */
@Getter
@Setter
@EqualsAndHashCode
@ContentRowHeight(100)
@ColumnWidth(100 / 8)
public class ImageDemoData {
    private File file;
    private InputStream inputStream;
    /**
     * 如果string类型 必须指定转换器，string默认转换成string
     */
    @ExcelProperty(converter = StringImageConverter.class)
    private String string;
    private byte[] byteArray;
    /**
     * 根据url导出
     *
     * @since 2.1.1
     */
    private URL url;

    /**
     * 根据文件导出 并设置导出的位置。
     *
     * @since 3.0.0-beta1
     */
    private WriteCellData<Void> writeCellDataFile;
}


/**
 * 特殊格式说明 列宽、行高
 *
 * @Getter
 * @Setter
 * @EqualsAndHashCode
 * @ContentRowHeight(10)
 * @HeadRowHeight(20) 行高
 * @ColumnWidth(25) 列高
 * public class WidthAndHeightData {
 * @ExcelProperty("字符串标题") private String string;
 * @ExcelProperty("日期标题") private Date date;
 * @ColumnWidth(50) 列宽50
 * @ExcelProperty("数字标题") private Double doubleData;
 * }
 * <p>
 * 注解形式自定义样式
 * @Getter
 * @Setter
 * @EqualsAndHashCode // 头背景设置成红色 IndexedColors.RED.getIndex()
 * @HeadStyle(fillPatternType = FillPatternTypeEnum.SOLID_FOREGROUND, fillForegroundColor = 10)
 * // 头字体设置成20
 * @HeadFontStyle(fontHeightInPoints = 20)
 * // 内容的背景设置成绿色 IndexedColors.GREEN.getIndex()
 * @ContentStyle(fillPatternType = FillPatternTypeEnum.SOLID_FOREGROUND, fillForegroundColor = 17)
 * // 内容字体设置成20
 * @ContentFontStyle(fontHeightInPoints = 20)
 * public class DemoStyleData {
 * // 字符串的头背景设置成粉红 IndexedColors.PINK.getIndex()
 * @HeadStyle(fillPatternType = FillPatternTypeEnum.SOLID_FOREGROUND, fillForegroundColor = 14)
 * // 字符串的头字体设置成20
 * @HeadFontStyle(fontHeightInPoints = 30)
 * // 字符串的内容的背景设置成天蓝 IndexedColors.SKY_BLUE.getIndex()
 * @ContentStyle(fillPatternType = FillPatternTypeEnum.SOLID_FOREGROUND, fillForegroundColor = 40)
 * // 字符串的内容字体设置成20
 * @ContentFontStyle(fontHeightInPoints = 30)
 * @ExcelProperty("字符串标题") private String string;
 * @ExcelProperty("日期标题") private Date date;
 * @ExcelProperty("数字标题") private Double doubleData;
 * }
 * <p>
 * 样式的数据类
 * @Data // 头背景设置成红色 IndexedColors.RED.getIndex()
 * @HeadStyle(fillPatternType = FillPatternType.SOLID_FOREGROUND, fillForegroundColor = 10)
 * // 头字体设置成20
 * @HeadFontStyle(fontHeightInPoints = 20)
 * // 内容的背景设置成绿色 IndexedColors.GREEN.getIndex()
 * @ContentStyle(fillPatternType = FillPatternType.SOLID_FOREGROUND, fillForegroundColor = 17)
 * // 内容字体设置成20
 * @ContentFontStyle(fontHeightInPoints = 20)
 * public class DemoStyleData {
 * // 字符串的头背景设置成粉红 IndexedColors.PINK.getIndex()
 * @HeadStyle(fillPatternType = FillPatternType.SOLID_FOREGROUND, fillForegroundColor = 14)
 * // 字符串的头字体设置成20
 * @HeadFontStyle(fontHeightInPoints = 30)
 * // 字符串的内容的背景设置成天蓝 IndexedColors.SKY_BLUE.getIndex()
 * @ContentStyle(fillPatternType = FillPatternType.SOLID_FOREGROUND, fillForegroundColor = 40)
 * // 字符串的内容字体设置成20
 * @ContentFontStyle(fontHeightInPoints = 30)
 * @ExcelProperty("字符串标题") private String string;
 * @ExcelProperty("日期标题") private Date date;
 * @ExcelProperty("数字标题") private Double doubleData;
 * }
 **/